﻿using Futaba.SBus.Telemetry.Configuration;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Futaba.SBus.Tests.Telemetry
{
	[TestClass]
	public class SensorFactoryTests : BaseTest
	{
		[TestMethod, TestCategory("SBUS2.Sensor")]
		public void IsKnownSensorByAttribute()
		{
			var target = SensorFactory.DefaultInstance;
			const bool expected = true;
			var actual = target.IsKnownSensor("CUR-F1678");
			Assert.AreEqual(expected, actual);
		}

		[TestMethod, TestCategory("SBUS2.Sensor")]
		public void IsKnownSensorByName()
		{
			var target = SensorFactory.DefaultInstance;
			const bool expected = true;
			var actual = target.IsKnownSensor(SensorType.GpsSensor.ToString());
			Assert.AreEqual(expected, actual);
		}

		[TestMethod, TestCategory("SBUS2.Sensor")]
		public void IsKnownSensorFalse()
		{
			var target = SensorFactory.DefaultInstance;
			const bool expected = false;
			var actual = target.IsKnownSensor("I don't exist");
			Assert.AreEqual(expected, actual);
		}

		[TestMethod, TestCategory("SBUS2.Sensor")]
		public void GetKnownSensorOk()
		{
			var target = SensorFactory.DefaultInstance;
			var expected = SensorType.CurrentSensor;
			var actual = target.GetKnownSensorType("CUR-F1678");
			Assert.AreEqual(expected, actual);
		}

		[TestMethod, TestCategory("SBUS2.Sensor")]
		public void GetKnownSensorUnknown()
		{
			var target = SensorFactory.DefaultInstance;
			var expected = SensorType.Unknown;
			var actual = target.GetKnownSensorType("I don't exist");
			Assert.AreEqual(expected, actual);
		}
	}
}